<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class Animal{
            constructor(name){
                this.name ="哈哈哈哈"
            }
            greet(){
                console.log(this.name,"Hello,I'm the parent.")
            }
        }
        class Dog extends Animal{
            constructor(){
                super();
                this.name="嘻嘻嘻嘻"

            }
            greet(){
                super.greet()//同名调用父类属性
                //console.log(this.name,"Hello,I'm the son.")
            }
        }
        let dog = new Dog();
        dog.greet()
    </script>
</body>
</html>